/*1.编写类Book,定义方法updatePrice,实现更改书的价格
 具体：如果价格>150 就更改为150，如果价格>100,更该为100,否则不变。*/

        package Demo;
class Book{
    private int price;

    public Book(){

    }
    public Book(int price){
        this.price=price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getPrice() {
        return price;
    }

    public void update(int price){
        if(price>150){
            this.price=150;
        }
        else if(price>100&&price<150)
        {
            this.price=100;
        }else{

        }
        System.out.println("书的价格是"+this.price);
    }


}
public class TestBook {
    public static void main(String[] args) {
        Book book=new Book();
        book.update(130);
        book.update(190);
    }

}
